<template>
  <div class="user-box">
    <s-header :name="''"></s-header>
    <van-skeleton title :avatar="true" :row="3" :loading="state.loading">
      <div class="user-info">
        <div class="info">
          <img src="../assets/logo.jpg" />
          <div class="user-desc">
            <span class="title">{{ state.user.nickName ?? "" }}</span>
            <!-- <span>{{ state.user.loginName ?? "" }}</span> -->
            <span class="name"
              >{{ state.user.introduceSign ?? "" }}</span
            >
          </div>
        </div>
      </div>
    </van-skeleton>
    <ul class="user-list">
      <!-- <li class="van-hairline--bottom" @click="goTo('/order')">
        <span>我的订单</span>
        <van-icon name="arrow" />
      </li>
      <li class="van-hairline--bottom" @click="goTo('/setting')">
        <span>账号管理</span>
        <van-icon name="arrow" />
      </li>
      <li class="van-hairline--bottom" @click="goTo('/address', { from: 'mine' })">
        <span>地址管理</span>
        <van-icon name="arrow" />
      </li> -->
      <li class="list-item" @click="goTo('/about')">
        <span>关于我们</span>
        <van-icon name="arrow" />
      </li>
    </ul>
    <nav-bar></nav-bar>
  </div>
</template>

<script setup>
import { reactive, onMounted, toRefs } from "vue";
import navBar from "@/components/NavBar.vue";
import sHeader from "@/components/SimpleHeader.vue";
import { getUserInfo } from "@/service/user";
import { useRouter } from "vue-router";
const router = useRouter();
const state = reactive({
  user: {},
  loading: true,
});

onMounted(async () => {
  // const { data } = await getUserInfo()
  const data = {
    nickName: "天狼户外装备",
    loginName: "user",
    introduceSign: "",
  };
  state.user = data;
  state.loading = false;
});

const goBack = () => {
  router.go(-1);
};

const goTo = (r, query) => {
  router.push({ path: r, query: query || {} });
};
</script>

<style lang="less" scoped>
@import "../common/style/mixin";
.user-box {
  .user-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    .fj();
    .wh(100%, 44px);
    line-height: 44px;
    padding: 0 10px;
    .boxSizing();
    color: #252525;
    background: #fff;
    border-bottom: 1px solid #dcdcdc;
    .user-name {
      font-size: 14px;
    }
  }
  .user-info {
    margin: 10px;
    height: 200px;
    background: linear-gradient(90deg, @primary, #51c7c7);
    box-shadow: 0 2px 5px #269090;
    border-radius: 6px;
    .info {
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 16px;
      width: 100%;
      height: 100%;
      padding: 25px 20px;
      .boxSizing();
      img {
        .wh(60px, 60px);
        border-radius: 50%;
        margin-top: 4px;
      }
      .user-desc {
        display: flex;
        flex-direction: column;
        margin-left: 10px;
        line-height: 20px;
        font-size: 14px;
        color: #fff;
        text-align: center;
        .title {
          font-size: 20px;
          font-weight: bold;
          margin-bottom: 0.5rem;
        }
        .name {
          font-size: 14px;
          color: #fff;
          text-align: center;
        }
        span {
          color: #f1f1f1;
          font-size: 14px;
          padding: 2px 0;
        }
      }
      .account-setting {
        position: absolute;
        top: 10px;
        right: 20px;
        font-size: 13px;
        color: #fff;
        .van-icon-setting-o {
          font-size: 16px;
          vertical-align: -3px;
          margin-right: 4px;
        }
      }
    }
  }
  .user-list {
    // padding: 10px;
    margin: 10px;
    box-shadow: 0 2px 5px #dcdcdc;
    border-radius: 5px;
    li {
      height: 40px;
      line-height: 40px;
      display: flex;
      justify-content: space-between;
      font-size: 14px;
      color: #252525;
      width: 100%;
      background: #fff;
      cursor: pointer;
      &:hover {
        background: #f5f5f5;
      }
      .van-icon-arrow {
        margin-top: 13px;
        margin-right: 10px;
      }
      span {
        padding: 0 10px;
        width: 100%;
      }
    }
  }
}
</style>
